package priv.yiyuan.example.design.wrapper;

/**
 * 积分计算装配器
 * <p>
 * 装饰器模式-具体装饰器
 *
 * @author YiYuan
 * @data 2025/9/2
 * @apoNote
 */
public class LoyaltyPointDecorator extends PaymentDecorator {

    public LoyaltyPointDecorator(PaymentStrategy decoratedPayment) {
        super(decoratedPayment);
    }

    @Override
    public void pay(double amount) {
        super.pay(amount);
        int points = (int) (amount * 0.1);
        System.out.println("计算积分: 获得 " + points + " 积分");
    }

    @Override
    public String getDescription() {
        return super.getDescription() + " + 积分计算";
    }
}
